defmodule Coffer.Storage.Local do

  alias Coffer.Transformation

  @sup Coffer.Transformation.Supervisor

  def store(definition, %Coffer.File{original_path: original_path} = file) do
    definition.versions
    |> Enum.map(&Task.Supervisor.async(@sup, Transformation, :transform, [&1, definition, file]))
    |> Enum.map(&Task.await(&1))
  end

end